<!--
 * @Description: 
 * @Author: xiongkuobiao
 * @Date: 2023-02-24 11:40:50
 * @LastEditors: xiongkuobiao
 * @LastEditTime: 2023-02-24 15:00:14
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    function promise1(color, timer) {
      return new Promise((resolve) => {
        setTimeout(() => {
          console.log(color);
          resolve();
        }, timer);
      });
    }

    function step() {
      return promise1("h", 2000)
        .then((res) => {
          return promise1("ss", 2000);
        })
        .then((res) => {
          return promise1("llll", 2000);
        })
        .then((res) => {
          return step();
        });
    }
    step();
  </script>
</html>
